home *** CD-ROM | disk | FTP | other *** search
- Global Const HIGHEST_TAB = 100
- Global Tabstops(-1 To HIGHEST_TAB) As Integer 'tab stops array
- Global NumTabStops As Integer 'number of tab stops in array
-
- 'This routine is called after each file is closed and
- 'all processing for that file is finished.
- Sub AfterAFile ()
- End Sub
-
- 'This routine is called at the very end of the program,
- 'after all files have been processed.
- Sub AfterAllFiles ()
- End Sub
-
- 'The return value of BeforeAFile is usually True, which
- 'indicates that the current file is to be processed
- 'normally. By returning False, you can skip processing
- 'the current file.
- Function BeforeAFile ()
- BeforeAFile = True
- End Function
-
- 'This routine is executed at the very beginning of the
- 'application, before any files are opened or any
- 'processing has taken place.
- Function BeforeAllFiles () As Integer
- APPNAME = "Detabbing Utility"
- Tabstops(-1) = 1
- SetTabStops.Show 1
- If SetTabStops.Tag = "CANCEL" Then
- BeforeAllFiles = False
- Else
- BeforeAllFiles = True
- End If
- End Function
-
- 'This routine is called over and over, each time being
- 'passed a succeeding line of the file being
- 'processed. Or, in binary mode, this routine is passed
- 'a chunk of bytes as long as RECLEN, except for the
- 'final chunk which may be smaller than RECLEN.
- Function DoALine (TheLine As String) As Integer
- Dim TabIndex As Integer 'index tab was found at
- Dim NumBlanks As Integer 'number of blanks to insert for this tab
-
- TabIndex = InStr(1, TheLine, Chr$(9))
- While TabIndex <> 0
- NumBlanks = FigureNumBlanks(TabIndex)
- TheBlanks$ = String$(NumBlanks, " ")
- Substitute TheLine, TabIndex, 1, TheBlanks$
- TabIndex = InStr((TabIndex + NumBlanks), TheLine, Chr$(9))
- Wend
- DoALine = True
- End Function
-
- Function FigureNumBlanks (TabNdx As Integer) As Integer
- FigureNumBlanks = 0
- For i% = -1 To NumTabStops - 1
- If TabNdx >= Tabstops(i%) And TabNdx < Tabstops(i% + 1) Then
- FigureNumBlanks = Tabstops(i% + 1) - TabNdx
- Exit Function
- End If
- Next i%
- End Function
-
-